#ifndef _DSWAXCENTER_H
#define _DSWAXCENTER_H
#include <libdswax/dswaxsession.h>
#include <libdswsession/dswavfwdsession.h>
#include <libdswsession/dswwanmsgsession.h>

class CDswaxcenter : public CDswbase
{
public:
	CDswaxcenter(LPST_ENV_T pEnv);
	virtual ~CDswaxcenter();
protected:
	static void cbSvrLinkCheckTask(int fd, short events, void* ctx){((CDswaxcenter*)ctx)->SvrLinkCheckTask(fd, events);};
	void SvrLinkCheckTask(int fd, short events);
private:
	LPST_ALARM_NODE_T GetAlarmNode(LPLIST_ST_ALARM_NODE_T pList);
	void PutAlarmNode(LPST_ALARM_NODE_T pNode, LPLIST_ST_ALARM_NODE_T pList);
protected:
	virtual int OnMessage(EN_MSG_TYPE nMsgType, void* pParam);
private:
	CDswaxsession *m_pCenterSession, *m_pRegisterSession, *m_pAlarmSession;
	CDswwanmsgsession* m_pWanMsgSession;
	ST_TIMER_PARAM_T m_nSvrLinkCheckTask;
	ST_SERVER_PARAM m_nForwardSvrInfo;
	time_t m_nLastHeartBeatTime;
	char m_sP2PID[32];

	LIST_ST_ALARM_NODE_T m_nAlarmList, m_nAlarmList_UnUsed;
	pthread_mutex_t m_nAlarmList_lock;
};

#endif

